﻿<%@ Page Title="New Commercial" Language="C#" MasterPageFile="~/user.master"
    AutoEventWireup="true" Inherits="MediaMonitor.Users.NewCommercial_filter" Theme="default"
    CodeBehind="NewCommercial-filter.aspx.cs" %>


<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="Server">
    <link href="../rad-scripts/Grid.MyCustomSkin.css" rel="stylesheet" type="text/css" />
    <link href="../rad-scripts/Input.MyCustomSkin.css" rel="stylesheet" type="text/css" />
    <link href="../rad-scripts/Menu.MyCustomSkin.css" rel="stylesheet" type="text/css" />
    <link href="../rad-scripts/slider.MyCustomSkin.css" rel="stylesheet" type="text/css" />
    <link href="../rad-scripts/Calendar.MyCustomSkin.css" rel="stylesheet" type="text/css" />
    <style>
        .alert-success
        {
            background-image: linear-gradient(to bottom, #DFF0D8 0px, #C8E5BC 100%);
            background-repeat: repeat-x;
            border-color: #B2DBA1;
        }

        .alert
        {
            box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
            text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
        }

        .alert-success
        {
            background-color: #DFF0D8;
            border-color: #D6E9C6;
            color: #3C763D;
        }

        .alert
        {
            border: 1px solid rgba(0, 0, 0, 0);
            border-radius: 4px;
            margin-bottom: 20px;
            padding: 15px;
        }

        .alert-danger
        {
            background-image: linear-gradient(to bottom, #F2DEDE 0px, #E7C3C3 100%);
            background-repeat: repeat-x;
            border-color: #DCA7A7;
        }

        .alert-danger
        {
            background-color: #F2DEDE;
            border-color: #EBCCD1;
            color: #A94442;
        }

        select
        {
            background-color: #FFFFFF;
            border: 1px solid #BCBCBC;
            color: #343434;
            display: inline;
            font-size: 12px;
            height: 30px!important;
            margin: 3px 3px 3px 0;
            padding: 3px;
        }

        .Button-Save
        {
            margin-left: 120px;
        }

        .Button-Load
        {
            margin-top: 60px;
        }

        .modalBackground
        {
            background-color: Gray;
            filter: alpha(opacity=80);
            opacity: 0.8;
            z-index: 10000;
        }

        .pnlpopup
        {
            border: 5px solid #737373;
            border-radius: 6px 6px 6px 6px;
            padding: 20px;
        }

        .closebtn
        {
            position: absolute;
            right: -10px;
            top: -13px;
        }

            .closebtn a
            {
                color: #FFFFFF;
                cursor: pointer;
                font-weight: bold;
                background: none repeat scroll 0 0 #137BD6;
                border-radius: 24px 24px 24px 24px;
                box-shadow: 0 0 6px #333333;
                float: right;
                padding: 2px 8px;
            }

        .table-data-pnlpopup
        {
            width: 100%;
        }

            .table-data-pnlpopup tbody td
            {
                padding: 3px 0;
            }

        .labelleft
        {
            float: left;
            margin-right: 20px;
            margin-top: 6px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server">


    <asp:Panel ID="pnlSearch" runat="server">

        <table>
            <tr>
                <td colspan="2"></td>

            </tr>
            <tr>
                <td style="width: 143px;">
                    <%--Brand--%> Product<span style="color: red">*</span>
                </td>
                <td><asp:HiddenField runat="server" ID="hdnEmails" />
                    
                      <asp:HiddenField runat="server" ID="hdnMediaAllCodeforEmails" />
                    <asp:TextBox runat="server" ID="txtProduct" Width="250px" ValidationGroup="send"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ValidationGroup="send" ID="RequiredFieldValidator2" ErrorMessage="Please Enter product name!" ControlToValidate="txtProduct" Display="Dynamic"></asp:RequiredFieldValidator>
                    <asp:AutoCompleteExtender
                        runat="server"
                        ID="autoComplete1"
                        TargetControlID="txtProduct"
                        ServiceMethod="AutoComplete_FillBrand"
                        ServicePath="NewCommercial-filter.aspx"
                        MinimumPrefixLength="3" CompletionInterval="200"
                        EnableCaching="false" CompletionSetCount="10" CompletionListCssClass="AutoExtender"
                        CompletionListItemCssClass="AutoExtenderList" ShowOnlyCurrentWordInCompletionListItem="false"
                        CompletionListHighlightedItemCssClass="AutoExtenderHighlight" DelimiterCharacters=";,:"
                        ContextKey="">
                    </asp:AutoCompleteExtender>
                </td>
            </tr>
            <tr>
                <td>Version <span style="color: red">*</span>
                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtVersion" ValidationGroup="send" MaxLength="300" Width="250px"> </asp:TextBox><asp:RequiredFieldValidator runat="server" ValidationGroup="send" ID="RequiredFieldValidator1" ErrorMessage="Please Enter version name!" ControlToValidate="txtVersion" Display="Dynamic"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>Launch Day<span style="color: red">*</span>
                </td>
                <td>
                    <telerik:RadDatePicker ID="RadDatePicker1" MinDate="2009/1/1" runat="server" DateInput-Label="Start:">
                    </telerik:RadDatePicker>
                    <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator3" ValidationGroup="send" ControlToValidate="RadDatePicker1"
                        ErrorMessage="Enter a date!"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>Duration

                </td>
                <td>
                    <asp:DropDownList runat="server" Style="width: 77px;" ID="ddlHours"></asp:DropDownList>&nbsp;&nbsp;
                    <asp:DropDownList runat="server" Style="width: 77px;" ID="ddlMinutes"></asp:DropDownList>&nbsp;&nbsp;<asp:DropDownList Style="width: 77px;" runat="server" ID="ddlSeconds"></asp:DropDownList>

                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:UpdatePanel ID="pnlUpdate_prod" runat="server">
                        <ContentTemplate>


                            <table>
                                <tr valign="top">
                                    <td style="width: 140px;">Sector</td>
                                    <td>
                                        <asp:DropDownList ID="lstSector" Style="width: 450px;" runat="server" AutoPostBack="true" OnSelectedIndexChanged="lstSector_Changed" DataTextField="SectorName" DataValueField="SectorCode" />
                                    </td>

                                </tr>
                                <tr>
                                    <td>Sub Sector</td>
                                    <td>
                                        <asp:DropDownList ID="lstSubSector" Style="width: 450px;" runat="server" AutoPostBack="true" OnSelectedIndexChanged="lstSubSector_Changed"
                                            DataTextField="SubSectorName" DataValueField="SubSectorCode" />
                                        <br />
                                    </td>
                                </tr>
                                <tr style='display: <%=AppUser.GetCountry()==177 ? "table-row": "none" %>'>
                                    <td>Sub Sector 2
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="lstSubSector2" Style="width: 450px;" runat="server" AutoPostBack="true" OnSelectedIndexChanged="lstSubSector_Changed"
                                            DataTextField="SubSectorName" DataValueField="SubSectorCode" />
                                        <br />
                                    </td>
                                </tr>
                                <tr>
                                    <td>Category</td>
                                    <td>
                                        <asp:DropDownList ID="lstCategory" Style="width: 450px;" runat="server" AutoPostBack="true"
                                            DataTextField="CategoryName" DataValueField="CategoryCode" OnSelectedIndexChanged="lstCategory_Changed" />
                                        &nbsp;&nbsp;
                    <asp:TextBox runat="server" ID="txtCategory" Visible="false" placeholder="Enter Category"></asp:TextBox>
                                    </td>
                                </tr>


                                <tr>
                                    <td>Advertiser
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="lstAdvertiser" Style="width: 450px;" runat="server"
                                            DataTextField="AdvertiserName" DataValueField="AdverTiserCode" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>Agency
                                    </td>
                                    <td>
                                        <asp:TextBox runat="server" Width="250px" ID="txtAgency" ReadOnly="true"></asp:TextBox>
                                    </td>
                                </tr>

                            </table>

                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
            </tr>
            <tr valign="top">
                <td colspan="2">
                    <fieldset>
                        <legend>Select at least one media type/Name<span style="color: red">*</span></legend>
                        <asp:HiddenField runat="server" ID="hdnMediaCodeType" />
                        <table>
                            <tr>
                                <td style="width: 140px;">First Appearance</td>
                                <td>

                                    <asp:LinkButton runat="server" ID="lnkbtnFirstAppearance" Text="Select Media" OnClick="lnkbtnFirstAppearance_click"></asp:LinkButton>
                                    <asp:Label runat="server" ID="lblFirstAppearance"></asp:Label><br />
                                    Estimated Hours
                                    <asp:DropDownList runat="server" ID="ddlEstimatedhoursFirstAppearance" Enabled="false"></asp:DropDownList>&nbsp;&nbsp;<asp:DropDownList runat="server" ID="ddlEstimatedMinutesFirstAppearance" Enabled="false"></asp:DropDownList>
                                    &nbsp;&nbsp;Program Name
                                    <asp:TextBox runat="server" ID="txtProgramNameFirstAppearance" MaxLength="300" Width="250px" Enabled="false"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>Second Appearance</td>
                                <td>
                                    <asp:LinkButton runat="server" ID="lnkbtnSecondAppearance" Text="Select Media" OnClick="lnkbtnSecondAppearance_click"></asp:LinkButton>
                                    <asp:Label runat="server" ID="lblSecondAppearance"></asp:Label><br />
                                    Estimated Hours
                                    <asp:DropDownList runat="server" ID="ddlEstimatedhoursSecondAppearance" Enabled="false"></asp:DropDownList>&nbsp;&nbsp;<asp:DropDownList runat="server" ID="ddlEstimatedMinutesSecondAppearance" Enabled="false"></asp:DropDownList>
                                    &nbsp;&nbsp;Program Name
                                    <asp:TextBox runat="server" ID="txtProgramNameSecondAppearance" MaxLength="300" Width="250px" Enabled="false"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>Third Appearance

                                </td>
                                <td>

                                    <asp:LinkButton runat="server" ID="lnkbtnThirdAppearance" Text="Select Media" OnClick="lnkbtnThirdAppearance_click"></asp:LinkButton>
                                    <asp:Label runat="server" ID="lblThirdAppearance"></asp:Label><br />
                                    Estimated Hours
                                    <asp:DropDownList runat="server" ID="ddlEstimatedhoursThirdAppearance" Enabled="false"></asp:DropDownList>&nbsp;&nbsp;<asp:DropDownList runat="server" ID="ddlEstimatedMinutesThirdAppearance" Enabled="false"></asp:DropDownList>
                                    &nbsp;&nbsp;Program Name
                                    <asp:TextBox runat="server" ID="txtProgramNameThirdAppearance" MaxLength="300" Width="250px" Enabled="false"></asp:TextBox>

                                </td>
                            </tr>
                        </table>
                    </fieldset>
                </td>
            </tr>


            <%--<tr>
                <td>Program Name

                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtProgramName" MaxLength="300" Width="250px"></asp:TextBox>
                </td>
            </tr>--%>
            <%-- <tr>
                <td>Estimated Hour
                </td>
                <td>
                    <asp:DropDownList Width="123px" runat="server" ID="ddlEstimatedHour"></asp:DropDownList>&nbsp;&nbsp;<asp:DropDownList Width="123px" runat="server" ID="ddlEstimatedMinute"></asp:DropDownList>
                </td>
            </tr>--%>
            <tr>
                <td>Comments

                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtComments" TextMode="MultiLine" Columns="10" Rows="5" Style="width: 450px; height: 90px;"></asp:TextBox>

                </td>

            </tr>
            <tr>
                <td>Upload commercial
                </td>
                <td>
                  
                            <asp:FileUpload ID="FileUploadControl" runat="server" Width="205px" />&nbsp;&nbsp;&nbsp;&nbsp;
                      <asp:ImageButton ID="imgBtnUpload" runat="server" OnClick="imgBtnUpload_Click" Height="32px" Width="32px" ToolTip="Upload file" ImageUrl="~/images/upload.png" />
                      

                </td>
            </tr>
            <tr>
                <td colspan="2"></td>

            </tr>
            <tr>
                <td></td>
                <td colspan="3">
                    <asp:ImageButton ID="btnSearch" runat="server" ValidationGroup="send" OnClick="btnSearch_Click" SkinID="Send" />
                    &nbsp;&nbsp;<asp:ImageButton ID="btnReset" runat="server" OnClick="btnReset_click" SkinID="Cancel" />
                    <script type="text/javascript">
                        function Confirm() {
                            var confirm_value = document.createElement("INPUT");
                            confirm_value.type = "hidden";
                            confirm_value.name = "confirm_value";
                            if (confirm("Do you want to save data?")) {
                                confirm_value.value = "Yes";
                            } else {
                                confirm_value.value = "No";
                            }
                            document.forms[0].appendChild(confirm_value);
                        }
                    </script>
                    <asp:UpdatePanel ID="pnlUpdate_Submit" runat="server">
                        <ContentTemplate>
                            <br />
                            <asp:HiddenField runat="server" ID="hdnImageFileName" />
                            <div runat="server" id="divsuccess" visible="false" class="alert alert-success">
                                <strong>File uploaded successfully.</strong>
                            </div>
                            <div runat="server" id="divError" visible="false" class="alert alert-danger">
                                <strong>Sorry! There is some problem. Please try again!</strong>
                            </div>
                            <div runat="server" id="divSuccessSend" visible="false" class="alert alert-success">
                                <strong>The mail has been sent successfully.</strong>
                            </div>
                            <div runat="server" id="divErrorSend" visible="false" class="alert alert-danger">
                                <strong>Sorry! There is some problem. Please try again or contact with admin!</strong>
                            </div>
                        </ContentTemplate>

                    </asp:UpdatePanel>
                </td>
            </tr>
        </table>
        <asp:HiddenField ID="HiddenField3" runat="server" />
        <asp:ModalPopupExtender ID="ModalPopupExtender4" runat="server" TargetControlID="HiddenField3"
            PopupControlID="Panel3" BackgroundCssClass="modalBackground" CancelControlID="A2">
        </asp:ModalPopupExtender>
        <asp:Panel ID="Panel3" CssClass="pnlpopup" runat="server" BackColor="White" Width="600px"
            Style="display: none;">
            <div class="closebtn">
                <a id="A2" runat="server">X</a>
            </div>

            <div style="overflow-y: scroll; overflow-x: hidden; width: 100%; height: 380px">
                <asp:UpdatePanel ID="pnlUpdate_Media" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
                    <ContentTemplate>
                        <table>
                            <tr>
                                <td>Media Type

                                </td>
                                <td>
                                    <asp:DropDownList ID="lstMediaType" Width="258px" runat="server"
                                        AutoPostBack="true" DataValueField="MediaTypeCode"
                                        DataTextField="MediaTypeName"
                                        OnSelectedIndexChanged="lstMediaType_SelectedIndexChanged" />
                                </td>
                            </tr>

                        </table>

                        <div id="dvMediaList" style="display: block;" class="Box">
                            <asp:CheckBoxList ID="lstMedia" runat="server" DataValueField="MediaCode" DataTextField="MediaName"
                                RepeatColumns="3" RepeatDirection="Horizontal" Font-Size="8px" ValidationGroup="send">
                            </asp:CheckBoxList>

                        </div>
                    </ContentTemplate>

                </asp:UpdatePanel>


                <script type="text/javascript">
                    function ValidateCheckBoxListLayout(sender, args) {
                        var checkBoxList = document.getElementById("<%=lstMedia.ClientID %>");
                        var checkboxes = checkBoxList.getElementsByTagName("input");
                        var isValid = false;
                        for (var i = 0; i < checkboxes.length; i++) {
                            if (checkboxes[i].checked) {
                                isValid = true;
                                break;
                            }
                        }
                        args.IsValid = isValid;
                    }
                </script>

            </div>
            <asp:CustomValidator ID="CustomValidator3" ErrorMessage="Please select at least one item!"
                ForeColor="Red" ClientValidationFunction="ValidateCheckBoxListLayout" ValidationGroup="tv"
                runat="server" />
            <br />
            <asp:Button ID="btnSaveTV" runat="server" CssClass="button" Text="Select" OnClick="btnSaveTV_Click"
                ValidationGroup="tv" />&nbsp;&nbsp;<asp:Button ID="btnCancelTV" runat="server" OnClick="btnCancelTV_click"
                    CssClass="button" Text="Cancel" />


        </asp:Panel>
    </asp:Panel>


</asp:Content>
